package com.cloudsigns.factorymanager2.engineering.activity;

import android.os.Bundle;
import android.support.annotation.IdRes;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.cloudsigns.factorymanager2.BaseActivity;
import com.cloudsigns.factorymanager2.R;

public class TeamMaintenanceFeedbackActivity extends BaseActivity{
    private RelativeLayout rl_back;
    private TextView tv_title;
    private RadioGroup rg_feedback_type;
    private RadioButton rb_problem_feedback,rb_end_feedback;
    private LinearLayout ll_problem_feedback,ll_end_feedback;
    private EditText edt_project_name,edt_maintenance_instructions;
    private ImageView iv_live_photo,iv_end_photo;
    private Button btn_submit;

    @Override
    protected void onBaseCreate(Bundle savedInstanceState) {
        setContentView(R.layout.layout_team_maintenance_feedback);
    }

    @Override
    protected void initView(Bundle savedInstanceState) {
        rl_back=findViewById(R.id.rl_back);
        tv_title=findViewById(R.id.tv_title);
        rg_feedback_type=findViewById(R.id.rg_feedback_type);
        rb_problem_feedback=findViewById(R.id.rb_problem_feedback);
        rb_end_feedback=findViewById(R.id.rb_end_feedback);
        ll_problem_feedback=findViewById(R.id.ll_problem_feedback);
        ll_end_feedback=findViewById(R.id.ll_end_feedback);
        edt_project_name=findViewById(R.id.edt_project_name);
        edt_maintenance_instructions=findViewById(R.id.edt_maintenance_instructions);
        iv_live_photo=findViewById(R.id.iv_live_photo);
        iv_end_photo=findViewById(R.id.iv_end_photo);
        btn_submit=findViewById(R.id.btn_submit);
    }

    @Override
    protected void initData(Bundle savedInstanceState) {
        tv_title.setText(getResources().getString(R.string.maintenance_feedback));

        rg_feedback_type.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup, @IdRes int id) {
                if (id == R.id.rb_problem_feedback) {
                    ll_problem_feedback.setVisibility(View.VISIBLE);
                    ll_end_feedback.setVisibility(View.GONE);
                } else if (id == R.id.rb_end_feedback) {
                    ll_problem_feedback.setVisibility(View.GONE);
                    ll_end_feedback.setVisibility(View.VISIBLE);
                }
            }
        });
    }

    @Override
    public void setListener() {
        rl_back.setOnClickListener(this);
        btn_submit.setOnClickListener(this);
    }

    @Override
    public void widgetClick(View v) {
        switch (v.getId()){
            case R.id.rl_back:
                finish();
                break;
                // 提交
            case R.id.btn_submit:
                break;
        }
    }
}
